package cn.iocoder.yudao.module.security.dal.mysql.asset;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.security.dal.dataobject.asset.SecurityAssetDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.security.controller.admin.asset.vo.*;

/**
 * 公司资产管理 Mapper
 *
 * @author cai
 */
@Mapper
public interface SecurityAssetMapper extends BaseMapperX<SecurityAssetDO> {

    default PageResult<SecurityAssetDO> selectPage(SecurityAssetPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SecurityAssetDO>()
                .likeIfPresent(SecurityAssetDO::getIpAddress, reqVO.getIpAddress())
                .likeIfPresent(SecurityAssetDO::getMacAddress, reqVO.getMacAddress())
                .eqIfPresent(SecurityAssetDO::getSourceType, reqVO.getSourceType())
                .eqIfPresent(SecurityAssetDO::getStatus, reqVO.getStatus())
                .eqIfPresent(SecurityAssetDO::getIpLong, reqVO.getIpLong())
                .likeIfPresent(SecurityAssetDO::getCompany, reqVO.getCompany())
                .likeIfPresent(SecurityAssetDO::getProductModel, reqVO.getProductModel())
                .likeIfPresent(SecurityAssetDO::getOperatingSystem, reqVO.getOperatingSystem())
                .betweenIfPresent(SecurityAssetDO::getCreateTime, reqVO.getUpdateTime())
                .betweenIfPresent(SecurityAssetDO::getIpLong, reqVO.getIpLongArr())
                .orderByDesc(SecurityAssetDO::getId));
    }

}